import 'package:flutter/material.dart';
import './router/index.dart';

///loading动画
import 'package:flutter_easyloading/flutter_easyloading.dart';

// 设置loading，其他配置见官方文档
void configLoading() {
  EasyLoading.instance
    // ..displayDuration = const Duration(milliseconds: 2000)  // 加载时间
    ..indicatorType = EasyLoadingIndicatorType.circle // 加载类型
    ..loadingStyle = EasyLoadingStyle.light // 加载样式
    ..indicatorSize = 45.0 // 大小
    ..maskType = EasyLoadingMaskType.none // 遮罩
    ..userInteractions = true // 使用单例模式
    ..toastPosition = EasyLoadingToastPosition.bottom
    ..dismissOnTap = false; // 指示器结束的点击时间
}

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'makeAPlan',
      theme: ThemeData(
          colorScheme: ColorScheme.fromSeed(
            primary: const Color(0xFF3084FC),
            seedColor: const Color.fromARGB(255, 255, 255, 255),
          ),
          useMaterial3: true,
          scaffoldBackgroundColor: const Color(0xFFFFFFFF),
          textTheme:
              const TextTheme(bodyMedium: TextStyle(color: Colors.black))),
      debugShowCheckedModeBanner: false,
      onGenerateRoute: RouterTable.onGenerateRoute,
      builder: EasyLoading.init(),
    );
  }
}
